package com.kukudexin;

/**
 * @author: 酷酷的鑫
 * @Date: 2021/12/8 18:05
 * @description: 泛型擦除
 */
public class Test19 {
    public static void main(String[] args) {
        GenericClass<Integer>  obj = new GenericClass<>();
        Integer intSize = obj.getSize();
        GenericClass obj2 = obj;
        Number size = obj2.getSize();

//        GenericClass<Double> obj3 = new GenericClass<>(3.0);
//        Double size1 = obj3.getSize();
//        System.out.println(size1);

    }
    //定义泛型类
    static class GenericClass< T extends  Number>{
        T size;

        public GenericClass(T size) {
            this.size = size;
        }

        public GenericClass() {
        }

        public T getSize() {
            return size;
        }

        public void setSize(T size) {
            this.size = size;
        }
    }
}
